#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define i128 __int128
#define mem(x) memset(x,0,sizeof(x))
#define endl "\n"
#define printYes cout << "Yes\n"
#define printYES cout << "YES\n"
#define printNo cout << "No\n"
#define printNO cout << "NO\n"
#define lowbit(x) ((x)&(-(x)))
#define pb push_back
#define mkp make_pair
#define pii pair<ll,int>
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define rep(i,j,k) for (int i=(j);i<=(k);i++)
#define per(i,j,k) for (int i=(j);i>=(k);i--)
#define pcnt(x) __builtin_popcount(x)
mt19937 rnd(time(0));
template<class T>void chkmin(T&x,T y){x=min(x,y);}
template<class T>void chkmax(T&x,T y){x=max(x,y);}

const ll inf=1000000000000000000; 
//const ll inf=1000000000;
//const ll mod=998244353;
//const ll mod=1000000007;

const int N=300005,M=1e6+5;
int n,m; 
ll A,B;

namespace workA
{
	vector<int>t[N];
	set<int>s[N];
	ll dis[N],d[N];
	bool vis[N];
	void dij()
	{
		priority_queue<pii>q;
		rep(i,1,n) dis[i]=inf,vis[i]=0;
		dis[1]=0;
		q.push(mkp(0,1));
		while (!q.empty())
		{
			int u=q.top().se;
			q.pop();
			if (vis[u]) continue;
			vis[u]=1;
			for (int i:t[u])
			{
				if (dis[i]>dis[u]+1)
				{
					dis[i]=dis[u]+1;
					q.push(mkp(-dis[i],i));
				}
			}
		}
	}
	bool used[N];
	int cnt;
	int h[N],nxt[M],v[M],pre[M];
	inline void add(int x,int y)
	{
		++cnt,v[cnt]=y;
		nxt[cnt]=h[x],pre[h[x]]=cnt,h[x]=cnt;
	}
	void del(int x)
	{
		int y=nxt[x],z=pre[x];
		nxt[z]=y,pre[y]=z;
	}
	void solve()
	{
		queue<int>q;
		rep(i,1,n) d[i]=inf,vis[i]=0;
		d[1]=0;
		vis[1]=1;
		q.push(1);
		vector<int>st;
		while (!q.empty())
		{
			int u=q.front();
			q.pop();
			for (int i:t[u]) used[i]=1;
			for (int i:t[u])
			{
				st.clear();
				for (int k=pre[i];k;k=pre[k])
				{
					int j=v[k];
					if (vis[j])
					{
						st.pb(k);
						continue;
					}
					else if (used[j]) continue;
					else 
					{
						d[j]=d[u]+1;
						vis[j]=1;
						q.push(j);
						st.pb(k);
					}
				}
				for (int j:st) del(j);
			}
			for (int i:t[u]) used[i]=0;
		}
	}	
	void work()
	{
		rep(i,1,n) h[i]=++cnt;
		rep(i,1,m)
		{
			int x,y;
			cin >> x >> y;
			t[x].pb(y),t[y].pb(x);
			add(x,y),add(y,x);
			//s[x].insert(y),s[y].insert(x);
		}
		dij();
		solve();
		//cout << cnt <<endl;
		// rep(i,1,n) cout << d[i] << " ";
		// cout << endl;
		rep(i,2,n)
		{
			ll ans=inf;
			if (dis[i]%2==0) chkmin(ans,dis[i]/2*B);
			else chkmin(ans,dis[i]/2*B+A);
			if (d[i]!=inf) chkmin(ans,d[i]*B);
			cout << ans << "\n";
		}
	}
}

namespace workB
{
	vector<pii>t[N];
	void add(int x,int y,int z)
	{
		t[x].pb(mkp(y,z)),t[y].pb(mkp(x,z));
	}
	ll dis[N];
	bool vis[N];
	priority_queue<pii>q;
	void dij()
	{
		rep(i,1,n) dis[i]=inf,vis[i]=0;
		dis[1]=0;
		q.push(mkp(0,1));
		while (!q.empty())
		{
			int u=q.top().se;
			q.pop();
			if (vis[u]) continue;
			vis[u]=1;
			for (pii i:t[u])
			{
				if (dis[i.fi]>dis[u]+i.se)
				{
					dis[i.fi]=dis[u]+i.se;
					q.push(mkp(-dis[i.fi],i.fi));
				}
			}
		}
		rep(i,2,n/2) cout << dis[i]/2 << "\n";
	}
	void work()
	{
		rep(i,1,m)
		{
			int x,y;
			cin >> x >> y;
			add(x,y,A*2),add(x+n,y,B),add(x,y+n,B);
		}
		n*=2;
		dij();
	}
}

int main()
{
	freopen("edge.in","r",stdin);
	freopen("edge.out","w",stdout);
	ios_base::sync_with_stdio(false);
	cin.tie(0);cout.tie(0);
	cin >> n >> m >> A >> B;
	if (A>B) workA::work();
	else workB::work();
	return 0;
}
